package xj.graph2d.app.prop;

import static xj.app.BaseApplicationFrame.getResourceString;

import xj.graph2d.app.DrawApp;
import xj.model.uml.State;

public class UMLStateModelPane extends UMLBasicModelPane {

  public UMLStateModelPane(DrawApp main, State.StateType type) {
    super(main);

    if (type != null) {
      if (type == State.StateType.State_Machine) {
	stateName = new ModelPropertiesPane.NameField("name", 
						      getResourceString("Name.text"));
	addRow(stateName);
      } else if (type == State.StateType.Submachine_State) {
	stateName = new ModelPropertiesPane.NameField("name", 
						      getResourceString("StateName.text"));
	addRow(stateName);

	submachineName = new ModelPropertiesPane.NameField("submachineName",
							   getResourceString("SubmachineName.text"));
	addRow(submachineName);
      } else if (type == State.StateType.Simple_State || 
		 type == State.StateType.Hyper_State || 
		 type == State.StateType.Orthogonal_State) {
	stateName = new ModelPropertiesPane.NameField("name", 
						      getResourceString("StateName.text"));
	addRow(stateName);

	entryAction = new ModelPropertiesPane.NameField("entryActionBody", 
							getResourceString("EntryAction.text"));
	addRow(entryAction);
	exitAction = new ModelPropertiesPane.NameField("exitActionBody", 
						       getResourceString("ExitAction.text"));
	addRow(exitAction);
	doAction = new ModelPropertiesPane.NameField("doActionBody", 
						     getResourceString("DoAction.text"));
	addRow(doAction);
      } else {
	stateName = new ModelPropertiesPane.NameField("name", 
						      getResourceString("StateName.text"));
	addRow(stateName);
      }
    } else {
      stateName = new ModelPropertiesPane.NameField("name", 
						    getResourceString("Name.text"));
      addRow(stateName);
    }

    addBasicFields();

    addFiller();
  }

  protected ModelPropertiesPane.NameField stateName;

  protected ModelPropertiesPane.NameField submachineName;

  protected ModelPropertiesPane.NameField entryAction;

  protected ModelPropertiesPane.NameField exitAction;

  protected ModelPropertiesPane.NameField doAction;

}
